|
@@ -13174,6 +13174,338 @@ namespace SiteCore.Handler
|
|
|
writeGridDataTableJson(dtNew.Rows.Count, dtNew);
|
|
writeGridDataTableJson(dtNew.Rows.Count, dtNew);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void get_place_all_order_data()
|
|
|
|
|
+ {
|
|
|
|
|
+ string date1 = GetPostString("date1");
|
|
|
|
|
+ string date2 = GetPostString("date2");
|
|
|
|
|
+ string starttime = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
|
|
|
|
|
+ DateTime start = DateTime.Parse(starttime);
|
|
|
|
|
+ string endtime = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
|
|
|
|
|
+ DateTime end = DateTime.Parse(endtime);
|
|
|
|
|
+ if (date1 != null && date1.Length > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ DateTime dateTime = DateTime.Parse(date1);
|
|
|
|
|
+ starttime = dateTime.ToString("yyyy-MM-dd 00:00:00");
|
|
|
|
|
+ start = DateTime.Parse(starttime);
|
|
|
|
|
+ endtime = dateTime.ToString("yyyy-MM-dd 23:59:59");
|
|
|
|
|
+ end = DateTime.Parse(endtime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (date2 != null && date2.Length > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ DateTime dateTime = DateTime.Parse(date2);
|
|
|
|
|
+ endtime = dateTime.ToString("yyyy-MM-dd 00:00:00");
|
|
|
|
|
+ end = DateTime.Parse(endtime);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Dictionary<string, Dictionary<string, int>> other_map = new Dictionary<string, Dictionary<string, int>>();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ string sql = string.Format("select SupplierId,ProductId,seller_memo,ProductCount,ProductName,payment,SupplierName,FinishPlaceTime,OrderState,FinishDeliveryTime from view_ErpTradeCell where ( FinishDeliveryTime BETWEEN '{0}' AND '{1}' ) AND IsSample = 0 and SupplierId > 0 ", starttime, endtime);
|
|
|
|
|
+ DataTable data = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
|
|
+
|
|
|
|
|
+ string timer_sql = string.Format("select * from CE_ErpSupplierProductTime");
|
|
|
|
|
+ DataTable timer_data = DbHelper.DbConn.ExecuteDataset(timer_sql).Tables[0];
|
|
|
|
|
+
|
|
|
|
|
+ Dictionary<int, List<CeErpSupplierProductTime>> timer_map = new Dictionary<int, List<CeErpSupplierProductTime>>();
|
|
|
|
|
+ foreach (DataRow datarow in timer_data.Rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ List<CeErpSupplierProductTime> list = null;
|
|
|
|
|
+ int supplierId = Convert.ToInt32(datarow["SupplierId"]);
|
|
|
|
|
+ if (timer_map.ContainsKey(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ timer_map.TryGetValue(supplierId, out list);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ list = new List<CeErpSupplierProductTime>();
|
|
|
|
|
+ timer_map.Add(supplierId, list);
|
|
|
|
|
+ timer_map.TryGetValue(supplierId, out list);
|
|
|
|
|
+ }
|
|
|
|
|
+ CeErpSupplierProductTime ceErpSupplierProductTime = new CeErpSupplierProductTime();
|
|
|
|
|
+
|
|
|
|
|
+ ceErpSupplierProductTime.quantity = Convert.ToInt32(datarow["quantity"]);
|
|
|
|
|
+ ceErpSupplierProductTime.dayDeadLine = datarow["dayDeadLine"].ToString();
|
|
|
|
|
+ ceErpSupplierProductTime.deadLine = datarow["deadLine"].ToString();
|
|
|
|
|
+ ceErpSupplierProductTime.productId = datarow["productId"].ToString();
|
|
|
|
|
+ ceErpSupplierProductTime.craft = datarow["craft"].ToString();
|
|
|
|
|
+ ceErpSupplierProductTime.sendDay = Convert.ToInt32(datarow["sendDay"]);
|
|
|
|
|
+ list.Add(ceErpSupplierProductTime);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ List<int> smSupplier = new List<int>() { 97, 121, 119, 80 };
|
|
|
|
|
+ foreach (DataRow row in data.Rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ //存储数据
|
|
|
|
|
+ int productId = Convert.ToInt32(row["ProductId"]);
|
|
|
|
|
+ string ProductName = row["ProductName"].ToString();
|
|
|
|
|
+
|
|
|
|
|
+ int supplierId = Convert.ToInt32(row["SupplierId"]);
|
|
|
|
|
+ if (no_suppliers.Contains(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ string seller_memo = row["seller_memo"].ToString();
|
|
|
|
|
+
|
|
|
|
|
+ bool ispj = false;//是否配件单
|
|
|
|
|
+ bool isfirst = true;//第一个配
|
|
|
|
|
+
|
|
|
|
|
+ maps.Keys.ForEach(key =>
|
|
|
|
|
+ {
|
|
|
|
|
+ //备注包含配件
|
|
|
|
|
+ if (seller_memo.Contains(key) && isfirst)
|
|
|
|
|
+ {
|
|
|
|
|
+ List<string> list = maps[key];
|
|
|
|
|
+ ispj = true;
|
|
|
|
|
+ isfirst = false;
|
|
|
|
|
+ for (int i = 0; i < list.Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (seller_memo.Contains(list[i]))
|
|
|
|
|
+ {
|
|
|
|
|
+ ispj = false;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (ispj)
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ seller_memo = seller_memo.Replace("UV", "uv");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("贡锻布", "贡缎布");
|
|
|
|
|
+
|
|
|
|
|
+ //吊牌归到卡片
|
|
|
|
|
+ seller_memo = seller_memo.Replace("吊牌", "卡片");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("卡套", "卡片");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("封套", "卡片");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("吸管套", "卡片");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("腰封", "卡片");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("旗帜布", "条幅");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("手拉旗", "条幅");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("横幅", "条幅");
|
|
|
|
|
+ seller_memo = seller_memo.Replace("锦旗", "条幅");
|
|
|
|
|
+
|
|
|
|
|
+ string map_key = "";
|
|
|
|
|
+ string type = "";
|
|
|
|
|
+
|
|
|
|
|
+ if (supplierMap.ContainsKey(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (var kvp in supplierMap[supplierId])
|
|
|
|
|
+ {
|
|
|
|
|
+ if (seller_memo.Contains(kvp.Key))
|
|
|
|
|
+ {
|
|
|
|
|
+ map_key = kvp.Value;
|
|
|
|
|
+ type = kvp.Value;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (map_key == "")
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ type = ProductName;
|
|
|
|
|
+ map_key = ProductName;
|
|
|
|
|
+ if (smSupplier.Contains(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "数码";
|
|
|
|
|
+ map_key = "数码";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("其他".Equals(map_key) && suppliers.ContainsKey(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ map_key = suppliers[supplierId];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ map_key += "_" + row["SupplierName"].ToString();
|
|
|
|
|
+
|
|
|
|
|
+ Dictionary<string, int> map = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (other_map.ContainsKey(map_key))
|
|
|
|
|
+ {
|
|
|
|
|
+ other_map.TryGetValue(map_key, out map);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ map = new Dictionary<string, int>();
|
|
|
|
|
+ map.Add("all", 0);//全部
|
|
|
|
|
+ map.Add("unusua", 0);//异常数
|
|
|
|
|
+ map.Add("normal", 0);//正常数
|
|
|
|
|
+ map.Add("noMatch", 0);//未匹配
|
|
|
|
|
+ other_map.Add(map_key, map);
|
|
|
|
|
+ other_map.TryGetValue(map_key, out map);
|
|
|
|
|
+ }
|
|
|
|
|
+ //处理是否超时
|
|
|
|
|
+
|
|
|
|
|
+ string finishPlaceTime = row["FinishPlaceTime"].ToString();
|
|
|
|
|
+ string sellmer_mome = row["seller_memo"].ToString();
|
|
|
|
|
+ string txtCount = row["ProductCount"].ToString();
|
|
|
|
|
+ string FinishDeliveryTime = row["FinishDeliveryTime"].ToString();
|
|
|
|
|
+
|
|
|
|
|
+ map["all"]++;
|
|
|
|
|
+ if (string.IsNullOrEmpty(finishPlaceTime))
|
|
|
|
|
+ {
|
|
|
|
|
+ map["noMatch"]++;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (string.IsNullOrEmpty(FinishDeliveryTime))
|
|
|
|
|
+ {
|
|
|
|
|
+ map["noMatch"]++;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!timer_map.ContainsKey(supplierId))
|
|
|
|
|
+ {
|
|
|
|
|
+ map["noMatch"]++;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<CeErpSupplierProductTime> lists = timer_map[supplierId];
|
|
|
|
|
+ if (lists.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ bool isComplate = false;
|
|
|
|
|
+ string[] productIds = null;
|
|
|
|
|
+ foreach (CeErpSupplierProductTime ceErpSupplierProductTime in lists)
|
|
|
|
|
+ {
|
|
|
|
|
+ string[] crafts = { };
|
|
|
|
|
+ if (string.IsNullOrEmpty(ceErpSupplierProductTime.productId))
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ceErpSupplierProductTime.quantity > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ int quantity = commonHelper.handleProductCount(txtCount, true);
|
|
|
|
|
+ //订单数量大于写入的数量则跳过
|
|
|
|
|
+ if (quantity > ceErpSupplierProductTime.quantity)
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ productIds = ceErpSupplierProductTime.productId.Split(',');
|
|
|
|
|
+ if (productIds.Contains(productId.ToString()))
|
|
|
|
|
+ {
|
|
|
|
|
+ string textCraft = ceErpSupplierProductTime.craft;
|
|
|
|
|
+ textCraft = textCraft.Replace(",", ",");//统一格式
|
|
|
|
|
+ if (!string.IsNullOrEmpty(textCraft))
|
|
|
|
|
+ {
|
|
|
|
|
+ crafts = textCraft.Split(',');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (crafts.Length > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ bool isinCraft = false;
|
|
|
|
|
+ for (int i = 0; i < crafts.Length; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (sellmer_mome.IndexOf(crafts[i]) >= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ isinCraft = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //有写工艺并且备注中没匹配中则跳过
|
|
|
|
|
+ if (!isinCraft)
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ DateTime deadLine = DateTime.Parse(ceErpSupplierProductTime.deadLine);
|
|
|
|
|
+ DateTime dayDeadLine = DateTime.Parse(ceErpSupplierProductTime.dayDeadLine);
|
|
|
|
|
+
|
|
|
|
|
+ int sendDay = ceErpSupplierProductTime.sendDay;
|
|
|
|
|
+
|
|
|
|
|
+ //订单发货时间
|
|
|
|
|
+ DateTime placeTime = DateTime.Parse(finishPlaceTime);
|
|
|
|
|
+
|
|
|
|
|
+ DateTime sendtime = DateTime.Now;//预计发货时间
|
|
|
|
|
+
|
|
|
|
|
+ DateTime dateTime = DateTime.Parse(FinishDeliveryTime);//实际发货时间
|
|
|
|
|
+
|
|
|
|
|
+ //下单时间小于当日发货时间则不用判断
|
|
|
|
|
+ //当日发货必须发货
|
|
|
|
|
+ if (dayDeadLine.Hour > 0 && dayDeadLine.Hour > placeTime.Hour)
|
|
|
|
|
+ {
|
|
|
|
|
+ sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 23:59:59"));
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
|
|
|
|
|
+ {
|
|
|
|
|
+ //在截稿时间之前下单的可以减去一天时间
|
|
|
|
|
+ sendDay = Math.Max(1, sendDay - 1);
|
|
|
|
|
+ sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 00:00:00")).AddDays(sendDay);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ sendDay = Math.Max(1, sendDay - 1);
|
|
|
|
|
+ sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 23:59:59")).AddDays(sendDay);
|
|
|
|
|
+ }
|
|
|
|
|
+ isComplate = true;
|
|
|
|
|
+ //判断有没有到发货日期大于0还没到发货时间
|
|
|
|
|
+ if (DateTime.Compare(sendtime.Date, dateTime.Date) < 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ //匹配到就不要继续匹配了
|
|
|
|
|
+ map["unusua"]++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ map["normal"]++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!isComplate)
|
|
|
|
|
+ {
|
|
|
|
|
+ map["noMatch"]++;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ map["noMatch"]++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ DataTable dt = new DataTable();
|
|
|
|
|
+
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("ProductName", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("SupplierName", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("all", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("unusua", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("normal", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("noMatch", typeof(string)));
|
|
|
|
|
+ dt.Columns.Add(new DataColumn("shipmentRate", typeof(string)));
|
|
|
|
|
+
|
|
|
|
|
+ other_map.Keys.ForEach(key =>
|
|
|
|
|
+ {
|
|
|
|
|
+ DataRow dr = dt.NewRow();
|
|
|
|
|
+
|
|
|
|
|
+ Dictionary<string, int> map = other_map[key];
|
|
|
|
|
+
|
|
|
|
|
+ string[] key_list = key.Split('_');
|
|
|
|
|
+ dr[0] = key_list[0];
|
|
|
|
|
+ dr[1] = key_list[1];
|
|
|
|
|
+ if (key_list.Length > 2)
|
|
|
|
|
+ {
|
|
|
|
|
+ dr[1] += "(" + key_list[2] + ")";
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ dr[2] = map["all"];
|
|
|
|
|
+ dr[3] = map["unusua"];
|
|
|
|
|
+ dr[4] = map["normal"];
|
|
|
|
|
+ dr[5] = map["noMatch"];
|
|
|
|
|
+ double rate = 0.00;
|
|
|
|
|
+ if (map["all"] > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ rate = Math.Round(((Convert.ToDouble(map["normal"]) + Convert.ToDouble(map["noMatch"])) / Convert.ToDouble(map["all"])), 2) * 100;
|
|
|
|
|
+ }
|
|
|
|
|
+ dr[6] = rate.ToString();
|
|
|
|
|
+ dt.Rows.Add(dr);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ DataView dv = new DataView(dt);
|
|
|
|
|
+ dv.Sort = "SupplierName";
|
|
|
|
|
+ //dv.Sort = "ProductName desc";
|
|
|
|
|
+ DataTable dtNew = dv.ToTable();
|
|
|
|
|
+ writeGridDataTableJson(dtNew.Rows.Count, dtNew);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void check_order_desing_info()
|
|
public void check_order_desing_info()
|
|
|
{
|
|
{
|
|
|
string ctid = GetPostString("ctid");
|
|
string ctid = GetPostString("ctid");
|