private Boolean check(String key)
        {
            ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;


            if (selectRows.Count() < 1)
            {
                this.View.ShowErrMessage("请至少选中一条数据!");
                return(false);
            }

            //判断报错信息是否一致

            string Reason = Convert.ToString(selectRows[0].DataRow["FREASON"]);

            for (int i = 1; i < selectRows.Count(); i++)
            {
                if (string.Equals(Reason, Convert.ToString(selectRows[i].DataRow["FREASON"]), StringComparison.CurrentCultureIgnoreCase))
                {
                    Reason = Convert.ToString(selectRows[i].DataRow["FREASON"]);
                }
                else
                {
                    this.View.ShowErrMessage("选中数据必须为相同问题类型!");
                    return(false);
                }
            }

            if (!string.Equals(Reason, key, StringComparison.CurrentCultureIgnoreCase))
            {
                this.View.ShowErrMessage("请选择正确的处理方法!");
                return(false);
            }
            return(true);
        }
Exemple #2
0
        private Boolean checkData(String key)
        {
            if (string.Equals(key, "ReAudit", StringComparison.CurrentCultureIgnoreCase))
            {
                string filter = getSelectedRowsFErrorBillNo("FErrorBillNo");
                //查询无上游单据数据 写入错误信息表
                string strSql = string.Format(@"/*dialect*/	select distinct FBILLNO from T_SAL_OUTSTOCK where FDOCUMENTSTATUS='B' and FBILLNO in ({0})", filter);
                DynamicObjectCollection FBILLNOCol = DBUtils.ExecuteDynamicObject(this.Context, strSql);
                if (FBILLNOCol.Count > 0)
                {
                    string message = "单据编号为 :";
                    for (int i = 0; i < FBILLNOCol.Count; i++)
                    {
                        message = message + Convert.ToString(FBILLNOCol[i]["FBILLNO"] + ",");
                    }
                    message.TrimEnd(',');
                    message = message + "的销售出库单尚未审核!";
                    //e.Cancel = true;
                    this.View.ShowErrMessage(message);
                    return(false);
                }
            }
            if (string.Equals(key, "OverOutStockQua", StringComparison.CurrentCultureIgnoreCase))
            {
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                string message = "单据编号为 :";
                int    count   = 0;
                for (int i = 0; i < selectRows.Count(); i++)
                {
                    string strSql = string.Format(@"/*dialect*/select distinct tso.FBILLNO FBILLNO from T_SAL_OUTSTOCK tso,T_SAL_OUTSTOCKENTRY_r tsoer ,T_SAL_OUTSTOCKENTRY tsoe 
where tso.fid=tsoe.fid and tso.fid=tsoer.fid and tsoe.FENTRYID=tsoer.FENTRYID and tsoer.FSRCBILLNO='{0}' and tsoe.Fsrcbillseq='{1}'",
                                                  Convert.ToString(selectRows[i].DataRow["FSalenumber"]), Convert.ToString(selectRows[i].DataRow["FLinenumber"]));

                    DynamicObjectCollection FBILLNOCol = DBUtils.ExecuteDynamicObject(this.Context, strSql);

                    if (FBILLNOCol.Count > 0)
                    {
                        count++;
                        for (int k = 0; k < FBILLNOCol.Count; k++)
                        {
                            message = message + Convert.ToString(FBILLNOCol[k]["FBILLNO"] + ",");
                        }
                    }
                }
                if (count > 0)
                {
                    message.TrimEnd(',');
                    message = message + "的销售出库单尚未删除!";
                    //e.Cancel = true;
                    this.View.ShowErrMessage(message);
                    return(false);
                }
            }
            return(true);
        }
        private void GetF8Value(string strFormId, string strFieldOfName, string strFieldOfId, string strFilter)
        {
            ListShowParameter param = new ListShowParameter
            {
                FormId         = strFormId,
                MultiSelect    = false,
                IsShowApproved = false,
                IsShowUsed     = true,
                IsLookUp       = true
            };
            FormMetadata metadata     = (FormMetadata)MetaDataServiceHelper.Load(base.Context, strFormId, true);
            BusinessInfo businessInfo = metadata.BusinessInfo;
            //string str = CRMAllocationServiceHelper.GetFilter(base.Context, businessInfo, param.SqlParams);
            string str = CRMAllocationServiceHelper.GetFilter(base.Context, businessInfo);

            if (str.Length > 0)
            {
                if (strFilter.Length > 0)
                {
                    strFilter = strFilter + " AND " + str;
                }
                else
                {
                    strFilter = str;
                }
            }
            param.ListFilterParameter.Filter = strFilter;
            param.PageId       = Guid.NewGuid().ToString();
            param.ParentPageId = base.View.PageId;
            param.ListType     = 2;
            base.View.ShowForm(param, delegate(FormResult result) {
                if (result.ReturnData != null)
                {
                    ListSelectedRowCollection returnData = result.ReturnData as ListSelectedRowCollection;
                    if (returnData.Count != 0)
                    {
                        ListSelectedRow row = returnData[0];
                        this.View.Model.SetValue(strFieldOfId, row.PrimaryKeyValue);
                        this.View.Model.BeginIniti();
                        this.View.Model.SetValue(strFieldOfName, row.Name);
                        this.View.Model.EndIniti();
                        this.View.UpdateView(strFieldOfName);
                        if (strFieldOfName.ToUpperInvariant() == "FCUSTOMERNAME")
                        {
                            this.GetCustInfo(Convert.ToInt64(row.PrimaryKeyValue));
                        }
                        else if (strFieldOfName.ToUpperInvariant() == "FCONTACTNAME")
                        {
                            this.GetContactInfo(Convert.ToInt64(row.PrimaryKeyValue));
                        }
                    }
                }
            });
        }
Exemple #4
0
        private string getSelectedRowsFErrorBillNo(String key)
        {
            ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
            string Elements = string.Empty;

            for (int i = 0; i < selectRows.Count(); i++)
            {
                Elements = Elements + "'" + Convert.ToString(selectRows[i].DataRow[key]) + "'" + ",";
            }
            Elements = Elements.TrimEnd(',');
            return(Elements);
        }
        private Boolean check(String key)
        {
            //获取选中行
            ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;

            //检查选中行数
            if (selectRows.Count() < 1)
            {
                this.View.ShowErrMessage("请至少选中一条数据!");
                return(false);
            }

            //判断问题类型
            if (string.Equals(key, "ReAudit", StringComparison.CurrentCultureIgnoreCase))
            {
                string Reason = "更新库存不成功!";
                for (int i = 1; i < selectRows.Count(); i++)
                {
                    if (Convert.ToString(selectRows[i].DataRow["FREASON"]).Length >= 8 && !string.Equals(Reason, GetLastStr(Convert.ToString(selectRows[i].DataRow["FREASON"]), 8), StringComparison.CurrentCultureIgnoreCase))
                    {
                        this.View.ShowErrMessage("只能选择由于库存不足导致审核失败问题!");
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                //判断报错信息是否一致
                string Reason = Convert.ToString(selectRows[0].DataRow["FREASON"]);
                for (int i = 0; i < selectRows.Count(); i++)
                {
                    if (string.Equals(Reason, Convert.ToString(selectRows[i].DataRow["FREASON"]), StringComparison.CurrentCultureIgnoreCase))
                    {
                        Reason = Convert.ToString(selectRows[i].DataRow["FREASON"]);
                    }
                    else
                    {
                        this.View.ShowErrMessage("选中数据必须为相同问题类型!");
                        return(false);
                    }
                }

                if (!string.Equals(Reason, key, StringComparison.CurrentCultureIgnoreCase))
                {
                    this.View.ShowErrMessage("请选择正确的处理方法!");
                    return(false);
                }
                return(true);
            }
        }
Exemple #6
0
        /// <summary>
        /// 关联发货明细批量新增发货明细。
        /// </summary>
        /// <param name="ctx">上下文对象。</param>
        /// <param name="dataArray">发货明细关联发货通知数据实体数组。</param>
        /// <returns>返回新建保存事务结果。</returns>
        public IOperationResult CreateNewBillsFromInNoticeEntities(Context ctx, DynamicObjectCollection dataArray)
        {
            //取默认转换规则。
            var rule = ConvertServiceHelper.GetConvertRules(ctx, "BAH_WMS_Pickup", "BAH_WMS_Outbound")
                       .Where(element => element.IsDefault)
                       .FirstOrDefault();

            if (rule == null)
            {
                throw new KDBusinessException("RuleNotFound", "未找到拣货明细至发货明细之间,启用的转换规则,无法自动下推!");
            }

            ListSelectedRowCollection listSelectedRowCollection = new ListSelectedRowCollection();

            foreach (var data in dataArray)
            {
                var row = new ListSelectedRow(data["SourceBillId"].ToString(), data["SourceEntryId"].ToString(), 0, rule.SourceFormId)
                {
                    EntryEntityKey = "FEntity"
                };
                listSelectedRowCollection.Add(row);
            }//end foreach

            //将需要传入的数量作为参数传递进下推操作,并执行下推操作。
            PushArgs args = new PushArgs(rule, listSelectedRowCollection.ToArray());
            var      inDetailDataObjects = ConvertServiceHelper.Push(ctx, args)
                                           .Adaptive(result => result.ThrowWhenUnSuccess(op => op.GetResultMessage()))
                                           .Adaptive(result => result.TargetDataEntities.Select(entity => entity.DataEntity).ToArray());

            //修改明细行数据包。
            var inDetailMetadata        = FormMetaDataCache.GetCachedFormMetaData(ctx, rule.TargetFormId);
            var inDetailBillView        = inDetailMetadata.CreateBillView(ctx);
            var inDetailDynamicFormView = inDetailBillView as IDynamicFormViewService;
            var inDetailBusinessInfo    = inDetailMetadata.BusinessInfo;
            var inDetailEntryEntity     = inDetailBusinessInfo.GetEntity("FEntity");
            var inDetailEntryLink       = inDetailBusinessInfo.GetForm().LinkSet.LinkEntitys.FirstOrDefault();



            //调用上传操作,将暂存、保存、提交、审核操作放置在同一事务中执行。
            return(inDetailDataObjects.DoNothing(ctx, inDetailBusinessInfo, "Upload"));
        }//end method
Exemple #7
0
        private void GetSaleOrderListData(BeforeF7SelectEventArgs e, string key_Field, string FormId, string key_Item)
        {
            if (FormId == null || FormId.ToString().Length == 0)
            {
                return;
            }
            ListShowParameter          listShowParameter          = new ListShowParameter();
            ListRegularFilterParameter listRegularFilterParameter = new ListRegularFilterParameter();

            listRegularFilterParameter.Filter = string.Format(" FSALEORGID IN ({0})", this.selOrgId);
            listShowParameter.IsLookUp        = true;
            listShowParameter.ListType        = Convert.ToInt32(BOSEnums.Enu_ListType.BaseList);
            listShowParameter.ListFilterParameter.MergeFilter(e.ListFilterParameter);
            listShowParameter.IsShowUsed     = false;
            listShowParameter.IsShowApproved = e.IsShowApproved;
            listShowParameter.FormId         = FormId.ToString();
            listShowParameter.MultiSelect    = false;
            listShowParameter.PageId         = string.Format("{0}_{1}_F7", this.View.PageId, listShowParameter.FormId);
            this.View.ShowForm(listShowParameter, delegate(FormResult result)
            {
                object returnData = result.ReturnData;
                if (returnData is ListSelectedRowCollection)
                {
                    ListSelectedRowCollection listSelectedRowCollection = returnData as ListSelectedRowCollection;
                    if (listSelectedRowCollection != null && !listSelectedRowCollection.IsEmpty <ListSelectedRow>())
                    {
                        int row = e.Row;
                        if (key_Item.Trim() == "FBILLNO")
                        {
                            this.Model.SetValue(key_Field, listSelectedRowCollection[0].BillNo, row);
                        }
                        if (key_Item.Trim() == "FNUMBER")
                        {
                            this.Model.SetValue(key_Field, listSelectedRowCollection[0].Number, row);
                        }
                    }
                }
            });
        }
Exemple #8
0
        private void FillSelectedDatas(Kingdee.BOS.Core.DynamicForm.FormResult fre, BeforeF7SelectEventArgs e, DimentionScopeType scopetype)
        {
            if ((fre != null) && (fre.ReturnData != null))
            {
                ListSelectedRowCollection returnData = (ListSelectedRowCollection)fre.ReturnData;
                if ((returnData != null) && (returnData.Count != 0))
                {
                    StringBuilder builder  = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    bool          flag     = false;
                    foreach (ListSelectedRow row in returnData)
                    {
                        if (flag)
                        {
                            builder.Append(",");
                            builder2.Append(",");
                        }
                        flag = true;
                        builder.Append(row.PrimaryKeyValue);
                        builder2.Append(row.Name);
                    }
                    switch (scopetype)
                    {
                    case DimentionScopeType.Dimension:
                        this.View.Model.SetValue("FFilterKey", builder.ToString(), e.Row);
                        this.View.Model.SetValue("FFilterName", builder2.ToString(), e.Row);
                        this.View.Model.SetValue("FFilterKeyDesc", builder2.ToString(), e.Row);
                        return;

                    case DimentionScopeType.BillDimension:
                        this.View.Model.SetValue("FBillFilterKey", builder.ToString(), e.Row);
                        this.View.Model.SetValue("FBillFilterName", builder2.ToString(), e.Row);
                        this.View.Model.SetValue("FBillFilterKeyDesc", builder2.ToString(), e.Row);
                        return;
                    }
                }
            }
        }
Exemple #9
0
        public List <string> GetSelectedSalOrderNos()
        {
            ListSelectedRowCollection rows    = this.ListView.SelectedRowsInfo;
            List <string>             billNos = null;
            List <K3SalOrderInfo>     orders  = null;
            K3SalOrderInfo            order   = null;

            if (rows != null && rows.Count > 0)
            {
                orders  = new List <K3SalOrderInfo>();
                billNos = new List <string>();

                foreach (var row in rows)
                {
                    if (row != null)
                    {
                        order = new K3SalOrderInfo();
                        billNos.Add(row.BillNo);
                    }
                }
            }
            return(billNos);
        }
        ///// <summary>
        ///// 关联到货通知新增收货明细。
        ///// </summary>
        ///// <param name="ctx">上下文对象。</param>
        ///// <param name="data">收货明细关联到货通知数据实体。</param>
        ///// <returns>返回新建保存事务结果。</returns>s
        //public IOperationResult CreateNewBillFromInNoticeEntry(Context ctx, PutDetailLinkInDetailDto.InDetailEntryLinkInNotice data)
        //{
        //    return this.CreateNewBillsFromInNoticeEntities(ctx, new PutDetailLinkInDetailDto.InDetailEntryLinkInNotice[] { data });
        //}//end method

        /// <summary>
        /// 关联收货明细批量新增上架明细。
        /// </summary>
        /// <param name="ctx">上下文对象。</param>
        /// <param name="dataArray">上架明细关联收货通知数据实体数组。</param>
        /// <returns>返回新建保存事务结果。</returns>
        public IOperationResult CreateNewBillsFromInNoticeEntities(Context ctx, IEnumerable <PutDetailLinkInDetailDto.PutDetailEntryLinkInNotice> dataArray)
        {
            //取默认转换规则。
            var rule = ConvertServiceHelper.GetConvertRules(ctx, "BAH_WMS_Inbound", "BAH_WMS_Putaway")
                       .Where(element => element.IsDefault)
                       .FirstOrDefault();

            if (rule == null)
            {
                throw new KDBusinessException("RuleNotFound", "未找到收货明细至上架明细之间,启用的转换规则,无法自动下推!");
            }

            ListSelectedRowCollection listSelectedRowCollection = new ListSelectedRowCollection();

            foreach (var data in dataArray)
            {
                var row = new ListSelectedRow(data.SourceBillId.ToString(), data.SourceEntryId.ToString(), 0, rule.SourceFormId)
                {
                    EntryEntityKey = "FEntity"
                };
                listSelectedRowCollection.Add(row);
            }//end foreach
            //将需要传入的数量作为参数传递进下推操作,并执行下推操作。
            PushArgs args = new PushArgs(rule, listSelectedRowCollection.ToArray());
            var      inDetailDataObjects = ConvertServiceHelper.Push(ctx, args)
                                           .Adaptive(result => result.ThrowWhenUnSuccess(op => op.GetResultMessage()))
                                           .Adaptive(result => result.TargetDataEntities.Select(entity => entity.DataEntity).ToArray());
            //修改明细行数据包。
            var inDetailMetadata        = FormMetaDataCache.GetCachedFormMetaData(ctx, rule.TargetFormId);
            var inDetailBillView        = inDetailMetadata.CreateBillView(ctx);
            var inDetailDynamicFormView = inDetailBillView as IDynamicFormViewService;
            var inDetailBusinessInfo    = inDetailMetadata.BusinessInfo;
            var inDetailEntryEntity     = inDetailBusinessInfo.GetEntity("FEntity");
            var inDetailEntryLink       = inDetailBusinessInfo.GetForm().LinkSet.LinkEntitys.FirstOrDefault();

            foreach (var data in inDetailDataObjects)
            {
                //新建并加载已有数据包。
                inDetailBillView.AddNew(data);
                //逐行检索,并关联复制行。
                var entryCollection  = inDetailBillView.Model.GetEntityDataObject(inDetailEntryEntity);
                var entryMirrorArray = entryCollection.ToArray();
                foreach (var entry in entryMirrorArray)
                {
                    var sources = dataArray.Join(entry.Property <DynamicObjectCollection>(inDetailEntryLink.Key),
                                                 left => new { SourceEntryId = left.SourceEntryId, SourceBillId = left.SourceBillId },
                                                 right => new { SourceEntryId = right.Property <long>("SId"), SourceBillId = right.Property <long>("SBillId") },
                                                 (left, right) => left).ToArray();
                    for (int i = 0; i < sources.Count(); i++)
                    {
                        var entryIndex = entryCollection.IndexOf(entry);
                        var rowIndex   = entryIndex + i;
                        if (i > 0)
                        {
                            inDetailBillView.Model.CopyEntryRow("FEntity", entryIndex, rowIndex, true);
                        }//end if

                        var item = sources.ElementAt(i);
                        inDetailDynamicFormView.UpdateValue("FFromTrackNo", rowIndex, item.FromTrackNo);
                        inDetailDynamicFormView.UpdateValue("FToTrackNo", rowIndex, item.ToTrackNo);
                        inDetailDynamicFormView.SetItemValueByID("FToLocId", item.ToLocId, rowIndex);
                        if (item.ToAvgCty == 0)
                        {
                            inDetailDynamicFormView.UpdateValue("FFromCty", rowIndex, item.ToCty);
                            inDetailDynamicFormView.SetItemValueByID("FFromUnitId", item.ToUnitId, rowIndex);
                            inDetailDynamicFormView.UpdateValue("FFromQty", rowIndex, item.ToQty);
                        }
                        else
                        {
                            inDetailDynamicFormView.UpdateValue("FFromAvgCty", rowIndex, item.ToAvgCty);
                            inDetailDynamicFormView.SetItemValueByID("FFromUnitId", item.ToUnitId, rowIndex);
                            inDetailDynamicFormView.UpdateValue("FFromQty", rowIndex, item.ToQty);
                        }
                        //inDetailDynamicFormView.SetItemValueByID("FStockId", item.StockId, rowIndex);
                        //inDetailDynamicFormView.SetItemValueByID("FStockPlaceId", item.StockPlaceId, rowIndex);
                        //inDetailDynamicFormView.UpdateValue("FLotNo", rowIndex, item.BatchNo);
                        //inDetailDynamicFormView.UpdateValue("FProduceDate", rowIndex, item.KFDate);
                        //inDetailDynamicFormView.UpdateValue("FExpPeriod", rowIndex, item.ExpPeriod);
                        //inDetailDynamicFormView.UpdateValue("FSerialNo", rowIndex, item.SerialNo);


                        //inDetailDynamicFormView.UpdateValue("FTrayNo", rowIndex, item.TrayNo);
                        //inDetailDynamicFormView.UpdateValue("FEntryRemark", rowIndex, item.Remark);
                    } //end for
                }     //end foreach
            }         //end foreach

            //调用上传操作,将暂存、保存、提交、审核操作放置在同一事务中执行。
            return(inDetailDataObjects.DoNothing(ctx, inDetailBusinessInfo, "Upload"));
        }//end method
Exemple #11
0
        public override void BarItemClick(BarItemClickEventArgs e)
        {
            //处理无上游无对应销售订单
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoUpStream", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("无对应销售订单"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Deliverytable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update detablein set status=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //处理物料启用BOM管理,但是销售订单中未选中BOM版本
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoBom", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("物料启用BOM管理,但是销售订单中未选中BOM版本"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Deliverytable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update detablein set status=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //重新审核
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "ReAudit", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("更新库存出现异常情况,更新库存不成功!"))
                {
                    return;
                }
                //预检前端选择数据
                if (!checkData("ReAudit"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter   = getSelectedRowsFErrorBillNo("FErrorBillNo");
                string filterid = getSelectedRowsElements("fid");
                string strSql   = string.Format(@"/*dialect*/ Delete Deliverytable  where fid in ({0}) ", filterid);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为5 3D业务人员手工审核成功
                strSql = string.Format(@"/*dialect*/ Update detablein set status=5,ferrormsg='3D业务人员手工审核成功',fsubdate=GETDATE() where fbillno in ({0}) and status=2 ", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //大于可出库数量
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "OverOutStockQua", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("大于可出库数量"))
                {
                    return;
                }
                //预检前端选择数据
                if (!checkData("OverOutStockQua"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                for (int i = 0; i < selectRows.Count(); i++)
                {
                    string strSql = string.Format(@"/*dialect*/Delete Deliverytable where Salenumber='{0}' and Linenumber='{1}'",
                                                  Convert.ToString(selectRows[i].DataRow["FSalenumber"]), Convert.ToString(selectRows[i].DataRow["FLinenumber"]));
                    DBUtils.Execute(this.Context, strSql);
                    strSql = string.Format(@"/*dialect*/Delete detablein where Salenumber='{0}' and Linenumber='{1}'",
                                           Convert.ToString(selectRows[i].DataRow["FSalenumber"]), Convert.ToString(selectRows[i].DataRow["FLinenumber"]));
                    DBUtils.Execute(this.Context, strSql);
                    strSql = string.Format(@"/*dialect*/Delete detable where Salenumber='{0}' and Linenumber='{1}'",
                                           Convert.ToString(selectRows[i].DataRow["FSalenumber"]), Convert.ToString(selectRows[i].DataRow["FLinenumber"]));
                    DBUtils.Execute(this.Context, strSql);
                }
            }
            //lc add 查询状态为5的,未生成单据号,单据号为空
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbstatusnobill", StringComparison.CurrentCultureIgnoreCase))
            {
                string strSql = string.Format(@"/*dialect*/   update detablein set status=0 where status=5 and ( fbillno=' ' or fbillno='0' )
  and not id in (
  select detl.id  from detablein detl,
  (select  c.FSRCBILLNO,a.FSRCBILLSEQ 
  from T_SAL_OUTSTOCKENTRY a
  inner join T_SAL_OUTSTOCK b on a.FID=b.fid
  left join T_SAL_OUTSTOCKENTRY_R c on a.FENTRYID=c.FENTRYID
  ) outbill where detl.status=5 and detl.fbillno=' ' and detl.Salenumber=outbill.FSRCBILLNO and detl.Linenumber=outbill.FSRCBILLSEQ
  )

");
                DBUtils.Execute(this.Context, strSql);
            }
            // lc tbOutStatus5 这些已经生成出库单 状态设置为5 错误信息表也删掉;
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbOutStatus5", StringComparison.CurrentCultureIgnoreCase))
            {
                //先删除 出库错误信息表
                string strSql = string.Format(@"/*dialect*/   
 delete  from Deliverytable where DETABLEINID in 
  (
select     id from detablein din
left join  (select c.FSRCBILLNO,a.FSRCBILLSEQ,b.FBILLNO from  
  T_SAL_OUTSTOCKENTRY a  
  inner join T_SAL_OUTSTOCK b on a.FID=b.fid
  left join T_SAL_OUTSTOCKENTRY_R c on a.FENTRYID=c.FENTRYID ) b
  on din.Salenumber=b.FSRCBILLNO and din.Linenumber=b.FSRCBILLSEQ
  where din.status=2 and din.ferrormsg='大于可出库数量' and b.FBILLNO is not     null

  )



");
                DBUtils.Execute(this.Context, strSql);

                strSql = string.Format(@"/*dialect*/     update detablein set status=5  where id in ( select din.id  from  detablein din
left join  (select c.FSRCBILLNO,a.FSRCBILLSEQ,b.FBILLNO from  
  T_SAL_OUTSTOCKENTRY a  
  inner join T_SAL_OUTSTOCK b on a.FID=b.fid
  left join T_SAL_OUTSTOCKENTRY_R c on a.FENTRYID=c.FENTRYID ) b
  on din.Salenumber=b.FSRCBILLNO and din.Linenumber=b.FSRCBILLSEQ
  where din.status=2 and din.ferrormsg='大于可出库数量' and b.FBILLNO is not     null

  )

");
                DBUtils.Execute(this.Context, strSql);
            }
            //挂起
            // tbGQ
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbGQ", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                string filter = getSelectedRowsFErrorBillNo("fid");
                string strSql = string.Format(@"/*dialect*/ update Deliverytable set FErrorBillNo='挂起' where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            // tbGQ 反挂起
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbfGQ", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                string filter = getSelectedRowsFErrorBillNo("fid");
                string strSql = string.Format(@"/*dialect*/ update Deliverytable set FErrorBillNo=' ' where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //清除按钮:采购件无对应仓库、物料未维护生产车间、无对应销售订单,A,B,C 表清楚掉;问题错误表对应删掉
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbDELCQRK", StringComparison.CurrentCultureIgnoreCase))
            {
                //删除 出库错误信息表数据

                string strSql = string.Format(@"/*dialect*/  delete Deliverytable   where  FBILLNO in  (
    select   id from detablein where ferrormsg in('采购件无对应仓库','无对应销售订单','物料未维护生产车间')   and status=2  ) ");
                DBUtils.Execute(this.Context, strSql);
                // 删除 出库 B表
                string strSql2 = string.Format(@"/*dialect*/    delete detable from                         
							detablein c where c.Salenumber=detable.Salenumber and c.Linenumber=detable.Linenumber and  c.ferrormsg in('物料未维护生产车间','无对应销售订单')  and c.status=2
 ");

                DBUtils.Execute(this.Context, strSql2);

                // 删除 出库 C表
                string strSql3 = string.Format(@"/*dialect*/  delete from  detablein where ferrormsg in('采购件无对应仓库','无对应销售订单','物料未维护生产车间')   and status=2  ");

                DBUtils.Execute(this.Context, strSql3);
            }

            //重置按钮:无对应销售订单:81700101-00504-0    出库C表状态为1     无出库单生成
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbStatus1", StringComparison.CurrentCultureIgnoreCase))
            {
                //重置 为0 将不是处理中的数据,处理日期不是当天的代表进程已经卡死了

                string strSql = string.Format(@"/*dialect*/  update detablein set status=0 where status =1 and Fsubdate+0.5<getdate() and  ( fbillno=' ' or fbillno='0' )
 ");
                DBUtils.Execute(this.Context, strSql);
                // 重置 未生成出库单 如果生成请先删除掉
                string strSql2 = string.Format(@"/*dialect*/     update detablein set status=0  where status =1 and Fsubdate+0.5<getdate() 
 and fbillno not in (
   select fbillno from T_SAL_OUTSTOCK  
 ) and fbillno like 'XSCK%'
");

                DBUtils.Execute(this.Context, strSql2);
            }
            //20200320 删除关账错误数据 lcadd
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "btndelcloseGZ", StringComparison.CurrentCultureIgnoreCase))
            {
                string strSql = string.Format(@"/*dialect*/  delete from  Deliverytable where reason  like  '%关账%'  ");
                DBUtils.Execute(this.Context, strSql);
            }
            // 重置 辅助属性错误的 设置状态为0 辅助属性错误数据重置0 add lc 20200409
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "btnresetFz", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                // 辅助属性错误的 设置状态为0
                string filter = getSelectedRowsElements("FBILLNO");
                string strSql = string.Format(@"/*dialect*/ Update detablein set status=0  , FErrorStatus =0 ,ferrormsg ='' where ferrormsg like '%辅助属性不能为空%' and   id    in ({0}) and status=2 ", filter);
                DBUtils.Execute(this.Context, strSql);
                // delete from Deliverytable  where REASON like '%辅助属性%'
                string strSql2 = string.Format(@"/*dialect*/ delete from Deliverytable  where REASON like '%辅助属性%' and FBILLNO in ({0}) ", filter);
                DBUtils.Execute(this.Context, strSql2);
            }

            this.View.Refresh();
        }
        public override void BarItemClick(BarItemClickEventArgs e)
        {
            //处理无上游无对应销售订单
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoUpStream", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("无对应销售订单"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Allocationtable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update altablein set status=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //处理物料启用BOM管理,但是销售订单中未选中BOM版本
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoBom", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("物料启用BOM管理,但是销售订单中未选中BOM版本"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Allocationtable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update altablein set status=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //重新审核
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "ReAudit", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("ReAudit"))
                {
                    return;
                }
                //预检前端选择数据
                if (!checkData("ReAudit"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter   = getSelectedRowsFErrorBillNo("FErrorBillNo");
                string filterid = getSelectedRowsElements("fid");//出库接口使用清除更新库存不成功报错的按钮时,大于可出库数量的报错也会随之被清除,
                string strSql   = string.Format(@"/*dialect*/ Delete Allocationtable where fid in ({0}) ", filterid);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为5 3D业务人员手工审核成功
                strSql = string.Format(@"/*dialect*/ Update altablein set status=5,ferrormsg='3D业务人员手工审核成功',fsubdate=GETDATE() where fbillno in ({0})  and status=2", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //处理采购件无对应仓库
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoStock", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("采购件无对应仓库"))
                {
                    return;
                }

                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Allocationtable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update altablein set status=0,isPur=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //物料未维护生产车间
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "NoProduction", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!check("物料未维护生产车间"))
                {
                    return;
                }
                //删除对应错误信息表中的数据
                string filter = getSelectedRowsElements("fid");
                string strSql = string.Format(@"/*dialect*/ Delete Allocationtable where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
                //将接口待处理表对应数据状态置为0 等待抽数接口检查
                filter = getSelectedRowsElements("FBILLNO");
                strSql = string.Format(@"/*dialect*/ Update altablein set status=0 where id in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //tbnoBillStaus5
            //查询状态为5的,未生成单据号,单据号为空
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbnoBillStaus5", StringComparison.CurrentCultureIgnoreCase))
            {
                string strSql = string.Format(@"/*dialect*/ update altablein set status=0   
     where   status=5   and fbillno=' '
  and id not in (
  select atl.id   from altablein atl 
 left join  (
  select spinentry.FSALENUMBER,spinentry.FLINENUMBER,spin.FBILLNO from T_SP_INSTOCK spin
  inner join T_SP_INSTOCKentry spinentry on spin.FID= spinentry.fid
  ) b on atl.salenumber=b.FSALENUMBER and atl.linenumber=b.FLINENUMBER

  where   atl.status=5   and atl.fbillno=' ' and b.FBILLNO is not null
  )
");
                DBUtils.Execute(this.Context, strSql);
            }
            //挂起
            // tbGQ
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbGQ", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                string filter = getSelectedRowsFErrorBillNo("fid");
                string strSql = string.Format(@"/*dialect*/ update Allocationtable set FErrorBillNo='挂起' where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //反挂起
            // tbfGQ
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbfGQ", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                string filter = getSelectedRowsFErrorBillNo("fid");
                string strSql = string.Format(@"/*dialect*/ update Allocationtable set FErrorBillNo=' ' where fid in ({0})", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //

            //清除按钮:采购件无对应仓库、物料未维护生产车间、无对应销售订单,A,B,C 表清楚掉;问题错误表对应删掉
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbDELCQRK", StringComparison.CurrentCultureIgnoreCase))
            {
                //删除 调拨错误信息表数据

                string strSql = string.Format(@"/*dialect*/ delete   Allocationtable   where  FBILLNO in ( 
 select  id from altablein where ferrormsg in ('采购件无对应仓库','无对应销售订单','物料未维护生产车间')    and fbillno=' ' and status=2 )
  ");
                DBUtils.Execute(this.Context, strSql);
                // 删除 调拨 B表
                string strSql2 = string.Format(@"/*dialect*/ delete altable from altablein c where c.Salenumber=altable.Salenumber and c.Linenumber=altable.Linenumber and  c.ferrormsg in ('采购件无对应仓库','无对应销售订单','物料未维护生产车间')  and c.fbillno=' ' and c.status=2 ");

                DBUtils.Execute(this.Context, strSql2);

                // 删除 调拨 C表
                string strSql3 = string.Format(@"/*dialect*/ delete from altablein where ferrormsg in ('采购件无对应仓库','无对应销售订单','物料未维护生产车间') and fbillno=' ' and status=2 ");

                DBUtils.Execute(this.Context, strSql3);
            }

            //重置按钮:调拨C表中的状态为1,只生成简单生产入库单状态为审核中 调整设置为 0
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbStatus1", StringComparison.CurrentCultureIgnoreCase))
            {
                //重置 为0 将不是处理中的数据,处理日期不是当天的代表进程已经卡死了

                string strSql = string.Format(@"/*dialect*/ update   altablein set status=0 where status=1 and Fsubdate+0.5<getdate() 
   and    fbillno = ' '     
 ");
                DBUtils.Execute(this.Context, strSql);
                // 重置 未生成简单生产入库 如果生成请先删除掉
                string strSql2 = string.Format(@"/*dialect*/    update altablein  set status=0  where status=1 and Fsubdate+0.5<getdate() and
   fbillno  not in (
     select  fbillno from T_SP_INSTOCK
   )  and fbillno like 'JDSC%'
");

                DBUtils.Execute(this.Context, strSql2);

                // 重置 未生成直接调拨单 如果生成请先删除掉
                string strSql3 = string.Format(@"/*dialect*/     update altablein  set status=0   where status=1 and Fsubdate+0.5<getdate() and
   fbillno  not in (
     select  fbillno from T_STK_STKTRANSFERIN  
   )  and fbillno like 'ZJDB%'
 ");

                DBUtils.Execute(this.Context, strSql3);
            }
            // tbgz 45 问题45 ,销售订单单号为:8885449,第3行,异常列表无报错,调拨单未生成,入库C表中报采购件无对应仓库的错(8885792第2行)
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbgz", StringComparison.CurrentCultureIgnoreCase))
            {
                //删除 错误信息表对应的数据

                string strSql = string.Format(@"/*dialect*/  delete from Allocationtable where fbillno in (
 select id from altablein where status=2  and fbillno=' '  and ferrormsg  like '%关账%'
 )
");
                DBUtils.Execute(this.Context, strSql);
                // 重置 状态 为 0
                string strSql2 = string.Format(@"/*dialect*/    update altablein set status=0  where status=2  and fbillno=' '  and ferrormsg  like '%关账%'
");

                DBUtils.Execute(this.Context, strSql2);

                //lc 201911/14 add
                string strSql3 = string.Format(@"/*dialect*/  delete     from Allocationtable where fbillno in (
 select id from altablein where status in (2,5)  and fbillno<>' '  and ferrormsg  like '%关账%'
 )
");
                DBUtils.Execute(this.Context, strSql3);
            }
            //大于可调拨数量 重新抽取  tbdykdb

            //清除按钮:大于可调拨数量,重新抽取
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "tbdykdb", StringComparison.CurrentCultureIgnoreCase))
            {
                //获取选中行
                ListSelectedRowCollection selectRows = this.ListView.SelectedRowsInfo;
                //检查选中行数
                if (selectRows.Count() < 1)
                {
                    this.View.ShowErrMessage("请至少选中一条数据!");
                    return;
                }
                // 删除 调拨 B 表
                string filter = getSelectedRowsElements("FBILLNO");
                //lc 20200206 去掉
                //string strSql2 = string.Format(@"/*dialect*/ delete altable from altablein c where c.Salenumber=altable.Salenumber and c.Linenumber=altable.Linenumber and  c.ferrormsg in ('大于可调拨数量')   and c.status=2  and c.id in ({0}) ", filter);

                //DBUtils.Execute(this.Context, strSql2);

                // 删除 调拨 C表
                //string strSql3 = string.Format(@"/*dialect*/ delete   altablein  where   ferrormsg in ('大于可调拨数量')   and  status=2  and id in ({0}) ", filter );

                // DBUtils.Execute(this.Context, strSql3);


                //删除 调拨错误信息表数据
                filter = getSelectedRowsFErrorBillNo("fid");
                string strSql = string.Format(@"/*dialect*/  delete from Allocationtable where REASON  in ('大于可调拨数量')     and  fid in ({0}) ", filter);
                DBUtils.Execute(this.Context, strSql);
            }
            //20200320 删除关账错误数据 lcadd
            if (string.Equals(e.BarItemKey.ToUpperInvariant(), "btndelcloseGZ", StringComparison.CurrentCultureIgnoreCase))
            {
                string strSql = string.Format(@"/*dialect*/  delete from  Deliverytable where reason  like  '%关账%'  ");
                DBUtils.Execute(this.Context, strSql);
            }

            this.View.Refresh();
        }
Exemple #13
0
        public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.BarItemClick(e);

            string PformId = this.View.BillBusinessInfo.GetForm().Id;

            switch (PformId)
            {
            case "STK_InStock":      //采购入库
                tableName = "T_STK_INSTOCKENTRY";

                break;

            case "STK_MISCELLANEOUS":    //其他入库
                tableName = "T_STK_MISCELLANEOUSENTRY";

                break;

            case "SP_InStock":    //简单生产入库
                tableName = "T_SP_INSTOCKENTRY";

                break;

            case "STK_InitInStock":    //期初采购入库
                tableName = "T_STK_INITINSTOCKENTRY";

                break;

            case "STK_OEMInStock":    //受托加工材料入库
                tableName = "T_STK_OEMINSTOCKENTRY";

                break;

            case "STK_InvInit":
                tableName = "T_STK_INVINITDETAIL";
                break;

            default: break;
            }



            if (e.BarItemKey.Equals("tbQANo"))
            {
                List <string> ids      = new List <string>(); //所选择行的数据ID
                List <string> entryIds = new List <string>(); //所选择行的数据ID
                List <int>    lotIds   = new List <int>();
                string        sql      = "";


                ListSelectedRowCollection selectedRowsInfo = this.ListView.SelectedRowsInfo;
                if (selectedRowsInfo.Count == 0)
                {
                    this.ListView.ShowMessage("请选择至少一条数据!");
                    e.Cancel = true;
                }
                else
                {
                    foreach (var one in selectedRowsInfo)
                    {
                        if (null == one.EntryEntityKey)
                        {
                            ids.Add(one.PrimaryKeyValue);
                        }
                        else
                        {
                            entryIds.Add(one.EntryPrimaryKeyValue);
                        }
                    }
                    if (entryIds.Count != 0)
                    {
                        sql = string.Format("SELECT FLOT FROM {0} WHERE FLOT<>0 AND  FENTRYID IN  ({1})", tableName, string.Join(",", entryIds));
                    }
                    else if (ids.Count != 0)
                    {
                        sql = string.Format("SELECT FLOT FROM {0} WHERE  FLOT<>0 AND  fid IN  ({1})", tableName, string.Join(",", ids));
                    }

                    using (IDataReader reader = DBUtils.ExecuteReader(this.Context, sql))
                    {
                        while (reader.Read())
                        {
                            int s = reader.GetInt32(0);
                            lotIds.Add(s);
                        }
                    }

                    ShowBemForm(string.Join("','", ids), string.Join("','", entryIds), string.Join("','", lotIds), PformId);
                }
            }
        }
Exemple #14
0
        /// <summary>
        /// 获取被勾选中的出货表编码
        /// </summary>
        /// <returns></returns>
        private List <string> GetSelectedShipmentNos()
        {
            ListSelectedRowCollection rows = this.ListView.SelectedRowsInfo;

            return(rows.Select(r => r.BillNo).ToList());
        }