|
|
@@ -72,6 +72,7 @@ namespace SiteCore.Handler
|
|
|
//refundTmcHelper.Api_TmcRefundMsg("{\"content\":{\"afterStatus\":\"SUCCESS\",\"createTime\":1735287446000,\"desc\":\"\",\"interceptInvestor\":\"NONE\",\"interceptStatus\":\"NONE\",\"interceptType\":\"NONE\",\"lines\":[{\"num\":2,\"outerId\":\"\",\"price\":50.0,\"refAid\":\"313001208133750610\",\"refAlId\":\"313001208133750610\",\"refBoughtSkuId\":\"\",\"refOid\":\"4181722704291751006\",\"refOlId\":\"4181722704291751006\",\"refSkuId\":\"0\",\"refSpuId\":\"865893808768\",\"refundFee\":98.86,\"refundStatus\":\"SUCCESS\",\"title\":\"新年会抽奖券定制2025蛇年公司活动正副可撕代金券打印纪念票根奖品兑换尾牙晚宴邀请卡号码牌创意入场券设计\",\"totalFee\":98.86,\"type\":1}],\"logisticsCompany\":\"\",\"logisticsOrderNo\":\"\",\"mark2\":[],\"openBuyerNick\":\"0**\",\"openSellerNick\":\"万慕办公旗舰店\",\"posCode\":\"wanmu\",\"posId\":598798,\"reason\":\"订单信息拍错(规格/尺码/颜色等)\",\"receiverCity\":\"\",\"receiverCountry\":\"中国\",\"receiverDistrict\":\"\",\"receiverId\":\"\",\"receiverState\":\"\",\"receiverTown\":\"\",\"receiverZip\":\"\",\"refAid\":\"313001208133750610\",\"refOid\":\"4181722704291751006\",\"refPlatform\":\"TB\",\"refType\":\"TMALL\",\"refundCreateTime\":1735287358000,\"refundFee\":\"98.86\",\"refundPhase\":\"ON_SALE\",\"refundTime\":1735289443000,\"refundUpdateTime\":1735289443000,\"refundVersion\":1735287358100,\"senderAddress\":\"\",\"senderCity\":\"\",\"senderCountry\":\"中国\",\"senderDistrict\":\"\",\"senderMobile\":\"\",\"senderName\":\"\",\"senderPhone\":\"\",\"senderState\":\"\",\"senderTown\":\"\",\"senderZip\":\"\",\"status\":\"SUCCESS\",\"statusCode\":\"SUCCESS\",\"statusName\":\"退款成功\",\"totalFee\":\"98.86\",\"type\":\"REFUND\",\"updateTime\":1735289479000}}");
|
|
|
|
|
|
//string result = designHelper.API_CheckOrderTo("12123123123132", "456456465465");
|
|
|
+
|
|
|
List<string> lw = new List<string>();
|
|
|
string tid = GetPostString("ctid");
|
|
|
string date1 = GetPostString("date1");
|
|
|
@@ -6025,6 +6026,7 @@ namespace SiteCore.Handler
|
|
|
//string comCode = cpCode.Split('-')[0].ToString();
|
|
|
string apires = "";
|
|
|
string supplierName = commonHelper.getSupplierNameById(entity.SupplierId);
|
|
|
+ //isTogether=2是新的合包弹窗
|
|
|
if ((!string.IsNullOrEmpty(isTogether) && Convert.ToInt32(isTogether) == 1) || (!string.IsNullOrEmpty(isTogether) && Convert.ToInt32(isTogether) == 0) || string.IsNullOrEmpty(isTogether))
|
|
|
{
|
|
|
if (ctid.IndexOf("N") != -1)
|
|
|
@@ -6158,22 +6160,24 @@ namespace SiteCore.Handler
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(isTogether) && Convert.ToInt32(isTogether) == 2)
|
|
|
{
|
|
|
- StringBuilder allSql = new StringBuilder();
|
|
|
- allSql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo,tid from view_ErpTradeCell where SupplierId={0} and orderstate=6 and IsSample = 0", entity.SupplierId);
|
|
|
- if (string.IsNullOrEmpty(mainEn.receiverId))
|
|
|
- {
|
|
|
- allSql.AppendFormat(" and (tid='{0}');", entity.tid);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //查询同车间同状态下的收货地址相同的单子
|
|
|
- allSql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}') );", entity.tid, mainEn.receiverId, entity.IsSF);
|
|
|
- }
|
|
|
- DataTable dt = DbHelper.DbConn.ExecuteDataset(allSql.ToString()).Tables[0];
|
|
|
+
|
|
|
+ DataTable dt = getSameOrderList(entity, mainEn);
|
|
|
List<string> list = new List<string>();
|
|
|
List<string> send_list = new List<string>();
|
|
|
CeErpTradeCell ceErpTradeCell = new CeErpTradeCell();
|
|
|
CeErpTrade ceErpTrade = new CeErpTrade();
|
|
|
+ //可合包的合并一起发货
|
|
|
+ if (dt == null)
|
|
|
+ {
|
|
|
+ var res_objz = new
|
|
|
+ {
|
|
|
+ restype = 0,
|
|
|
+ data = "打单后发货失败"
|
|
|
+ };
|
|
|
+ string ro_jsonz = JsonConvert.SerializeObject(res_objz);
|
|
|
+ returnSuccess(ro_jsonz);
|
|
|
+ return;
|
|
|
+ }
|
|
|
foreach (DataRow row in dt.Rows)
|
|
|
{
|
|
|
list.Add("'" + row["ctid"] + "'");
|
|
|
@@ -7407,7 +7411,7 @@ namespace SiteCore.Handler
|
|
|
{
|
|
|
if (entity.DispatchSort == 2)
|
|
|
{
|
|
|
- designApiResponseVo response = designHelper.API_GetPrintData_CreateOrder(newentity);
|
|
|
+ designApiResponseVo response = designHelper.API_GetPrintData_CreateAfterOrder(newentity);
|
|
|
LogHelper.addLog(newentity.ctid, CurrentUser.UserID, "售后单生成指派:" + response.msg, newentity.OrderState, 1);
|
|
|
}
|
|
|
}
|
|
|
@@ -12859,6 +12863,10 @@ namespace SiteCore.Handler
|
|
|
{
|
|
|
ceErpTradeCellExtend.ToType = "外协";
|
|
|
}
|
|
|
+ if (ceErpTradeCell.seller_memo.Contains("改稿") || ceErpTradeCell.OtherMemo.Contains("改稿"))
|
|
|
+ {
|
|
|
+ ceErpTradeCellExtend.ToType = "内部";
|
|
|
+ }
|
|
|
if ("外协".Equals(ceErpTradeCellExtend.ToType))
|
|
|
{
|
|
|
string sql_pay = "update CE_ErpTradeCell with(rowlock) set DispatchSort=2 where ctid='" + ctid + "';";
|
|
|
@@ -13204,17 +13212,7 @@ namespace SiteCore.Handler
|
|
|
ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(new DataTable())) + "}");
|
|
|
return;
|
|
|
}
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo from view_ErpTradeCell where SupplierId={0} and orderstate=6 and IsSample = 0", entity.SupplierId);
|
|
|
- if (string.IsNullOrEmpty(ceErpTrade.receiverId))
|
|
|
- {
|
|
|
- sql.AppendFormat(" and (tid='{0}');", entity.tid);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}'));", entity.tid, ceErpTrade.receiverId, entity.IsSF);
|
|
|
- }
|
|
|
- DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
+ DataTable dt = getSameOrderList(entity, ceErpTrade);
|
|
|
List<string> ids = new List<string>();
|
|
|
if (dt != null && dt.Rows.Count > 1)
|
|
|
{
|
|
|
@@ -13242,7 +13240,7 @@ namespace SiteCore.Handler
|
|
|
ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(new DataTable())) + "}");
|
|
|
return;
|
|
|
}
|
|
|
- sql = new StringBuilder();
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
sql.AppendFormat("select * from CE_ErpDeliverMark where isDel = 0 and ctid in ({0});", string.Join(",", ids));
|
|
|
dt.Columns.Add(new DataColumn("dstate", typeof(int)));
|
|
|
dt.Columns.Add(new DataColumn("dnumber", typeof(int)));
|
|
|
@@ -13279,7 +13277,139 @@ namespace SiteCore.Handler
|
|
|
|
|
|
returnErrorMsg("缺少必要的参数");
|
|
|
}
|
|
|
+ private DataTable getSameOrderList(CeErpTradeCell entity, CeErpTrade ceErpTrade)
|
|
|
+ {
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
+ sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo,productId,FinishPlaceTime,ProductCount from view_ErpTradeCell where SupplierId={0} and orderstate=6", entity.SupplierId);
|
|
|
+ if (string.IsNullOrEmpty(ceErpTrade.receiverId))
|
|
|
+ {
|
|
|
+ sql.AppendFormat(" and (tid='{0}');", entity.tid);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}'));", entity.tid, ceErpTrade.receiverId, entity.IsSF);
|
|
|
+ }
|
|
|
+ DataTable dt = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
+ StringBuilder timerSql = new StringBuilder();
|
|
|
+ timerSql.AppendFormat("SELECT * FROM CE_ErpSupplierProductTime WHERE supplierId={0}", entity.SupplierId);
|
|
|
+ DataTable timerTable = DbHelper.DbConn.ExecuteDataset(timerSql.ToString()).Tables[0];
|
|
|
+ //没有设置时间则不判断
|
|
|
+ if (timerTable == null || timerTable.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
+ {
|
|
|
+ //当前订单
|
|
|
+ if (entity.ctid.Equals(dr["ctid"]))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //已经标记过发货
|
|
|
+ CeErpDeliverMark ceErpDeliverMark = CeErpDeliverMark.GetByCtid(dr["ctid"].ToString());
|
|
|
+ if (ceErpDeliverMark != null)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ string[] productIds = null;
|
|
|
+ string productId = dr["productId"].ToString();
|
|
|
+ string finishPlaceTime = dr["FinishPlaceTime"].ToString();
|
|
|
+ string sellmer_mome = dr["seller_memo"].ToString();
|
|
|
+ string txtCount = dr["ProductCount"].ToString();
|
|
|
+ DateTime placeTime = DateTime.Now;
|
|
|
+ //没有品类
|
|
|
+ if (string.IsNullOrEmpty(productId) || "0".Equals(productId))
|
|
|
+ {
|
|
|
+ dr.Delete();//标记删除
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (string.IsNullOrEmpty(finishPlaceTime))
|
|
|
+ {
|
|
|
+ dr.Delete();//标记删除
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ placeTime = DateTime.Parse(finishPlaceTime);
|
|
|
+ foreach (DataRow row in timerTable.Rows)
|
|
|
+ {
|
|
|
+ string txtIds = row["productId"].ToString();
|
|
|
+ string[] crafts = { };
|
|
|
+ int count = Convert.ToUInt16(row["quantity"]);
|
|
|
+ if (string.IsNullOrEmpty(txtIds))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ int quantity = commonHelper.handleProductCount(txtCount, true);
|
|
|
+ //订单数量大于写入的数量则跳过
|
|
|
+ if (quantity > count)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ productIds = txtIds.Split(',');
|
|
|
+ if (productIds.Contains(productId))
|
|
|
+ {
|
|
|
+ string textCraft = row["craft"].ToString();
|
|
|
+ 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(row["deadLine"].ToString());
|
|
|
+ DateTime dayDeadLine = DateTime.Parse(row["dayDeadLine"].ToString());
|
|
|
+
|
|
|
+ int sendDay = Convert.ToInt16(row["sendDay"]);
|
|
|
+
|
|
|
+ //下单时间小于当日发货时间则不用判断
|
|
|
+ if (dayDeadLine.Hour > 0 && dayDeadLine.Hour > placeTime.Hour)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //在截稿时间之前下单的可以减去一天时间
|
|
|
+ if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
|
|
|
+ {
|
|
|
+ sendDay = Math.Max(1, sendDay - 1);
|
|
|
+ }
|
|
|
+ DateTime sendtime = placeTime.AddDays(sendDay);
|
|
|
+ //判断有没有到发货日期
|
|
|
+ if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) > 0)
|
|
|
+ {
|
|
|
+ dr.Delete();//标记删除
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt.AcceptChanges();//把标记的都删除
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
|
|
|
+ }
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
public void get_mark_number()
|
|
|
{
|
|
|
string eid = GetPostString("ctid");
|
|
|
@@ -13293,17 +13423,7 @@ namespace SiteCore.Handler
|
|
|
|
|
|
if (ceErpDeliverMark == null)
|
|
|
{
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo from view_ErpTradeCell where SupplierId={0} and orderstate=6 and IsSample = 0", entity.SupplierId);
|
|
|
- if (string.IsNullOrEmpty(ceErpTrade.receiverId))
|
|
|
- {
|
|
|
- sql.AppendFormat(" and (tid='{0}');", entity.tid);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}'));", entity.tid, ceErpTrade.receiverId, entity.IsSF);
|
|
|
- }
|
|
|
- DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
+ DataTable dt = getSameOrderList(entity, ceErpTrade);
|
|
|
List<string> ids = new List<string>();
|
|
|
if (dt != null && dt.Rows.Count > 1)
|
|
|
{
|
|
|
@@ -13312,7 +13432,7 @@ namespace SiteCore.Handler
|
|
|
ids.Add("'" + dr["ctid"] + "'");
|
|
|
}
|
|
|
//查询已有的编号
|
|
|
- sql = new StringBuilder();
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
sql.AppendFormat("select * from CE_ErpDeliverMark where isDel = 0 and ctid in ({0});", string.Join(",", ids));
|
|
|
DataTable dt1 = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
if (dt1 == null || dt1.Rows.Count == 0)
|
|
|
@@ -13467,10 +13587,7 @@ namespace SiteCore.Handler
|
|
|
|
|
|
|
|
|
string posTag = CurrentUser.UserPost.Post.Code;
|
|
|
- if (posTag != "SysAdmin")
|
|
|
- {
|
|
|
- lw.Add(string.Format("SupplierId in ({0})", CurrentUser.User.pemVend));
|
|
|
- }
|
|
|
+
|
|
|
dStruct.MainWhere = string.Join(" and ", lw.ToArray());
|
|
|
DataTable dt = WebCache.GetData("CE_ErpSupplierProductTime", dStruct);
|
|
|
writeGridDataTableJson(dStruct.TotalCount, dt);
|